﻿using GameServer.Virtual_Objects.Room;

namespace GameServer.Networking.Packets
{
    class PACKET_ROOM_SPAWN_TICK : Packet
    {
        public PACKET_ROOM_SPAWN_TICK(virtualRoom Room)
        {
            newPacket(30016);
            if (Room.Channel == 4)
            {
                addBlock(-1);
                addBlock(Room.RoundTimeSpent);
                addBlock(Room.zombiePoints); // Points
                addBlock(Room.zombiePoints); // Total Points
                addBlock(30);
            }
            else if(Room.Channel == 1)
            {
                addBlock(Room.RoundTimeSpent); // Spawn Counter
                addBlock(Room.RoundTimeLeft); // Time Left
                addBlock(((Room.Mode == 0) ? Room.cDerbRounds : -1)); //Current Round
                addBlock(((Room.Mode == 0) ? Room.cNiuRounds : -1)); //Current Round
                if (Room.Mode == 1)
                {
                    addBlock(Room.FFAKillPoints); // Mission Kills (FFA)
                    addBlock(Room.highestKills); // Current Leader Kills (FFA)
                }
                else
                {
                    if (Room.Mode == 2)
                    {
                        addBlock(Room.KillsDeberanLeft); // Score DERBERAN
                        addBlock(Room.KillsNIULeft); // Score NIU
                    }
                    else if(Room.Mode == 0)
                    {
                        addBlock(Room.AliveUsers(0)); // Players a life DERB
                        addBlock(Room.AliveUsers(1));  // Players a life NIU
                    }
                }

                if (Room.Mode == 0)
                {
                    addBlock(Room.cDerbRounds);
                    addBlock(Room.cNiuRounds);
                }
                addBlock(30);
                }
				
                else if (Room.Channel == 2)
                {
                    addBlock(Room.RoundTimeSpent); // Spawn Counter
                    addBlock(Room.RoundTimeLeft); // Time Left
                    addBlock(((Room.Mode == 0) ? Room.cDerbRounds : -1)); //Current Round
                    addBlock(((Room.Mode == 0) ? Room.cNiuRounds : -1)); //Current Round
                }

                else if (Room.Channel == 3)
                {
                    addBlock(Room.RoundTimeSpent); // Spawn Counter
                    addBlock(Room.RoundTimeLeft); // Time Left
                    addBlock(((Room.Mode == 0) ? Room.cDerbRounds : -1)); //Current Round
                    addBlock(((Room.Mode == 0) ? Room.cNiuRounds : -1)); //Current Round
                }

        }
    }
}
